/*
 * @Author: your name
 * @Date: 2022-02-10 22:19:04
 * @LastEditTime: 2022-02-10 22:29:30
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \ts\16枚举.ts
 */

// 相当于对象： { '0': 'One', '1': 'Two', '2': 'Three', One: 0, Two: 1, Three: 2 }
enum Status{
    One, // 默认序号0 开始
    Two,
    Three
}

enum Status2 {
    One =1, // 修改起始序号为1
    Two
}

enum Status3 {
    One,
    Two=3,
    Three // 4， 会从3开始，而不是2
}

// 使用
function enumTest(status:any) {
    if(status === Status.One) {
        console.log('this one',Status.One, Status[0])
    }else if(status === Status.Two) {
        console.log('this two',Status.Two)

    }else {
        console.log('this.three',Status.Three)
    }
}

enumTest(Status.One)
enumTest(1)

console.log(Status)
console.log(Status3)